import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/auth/token',
    method: 'post',
    data
  })
}

export function getCurrentInfo() {
  return request({
    url: '/auth/user/find',
    method: 'get',
  })
}

export function updateUserAvatar(data) {
  return request({
    url: '/file/upLoad/avatar',
    method: 'post',
    data
  })
}

export function getAvatar() {
  return request({
    url: '/avatars/ten-avatar.jpg',
    method: 'get',
    responseType:'arraybuffer',
  })
}

export function updateUserProfile(data) {
  return request({
    url: '/auth/user/update',
    method: 'post',
    data
  })
}

export function updatePwd(data) {
  return request({
    url: '/auth/user/updatePwd',
    method: 'post',
    data
  })
}


export function logout() {
  return request({
    url: '/auth/user/logout',
    method: 'post'
  })
}
